#!/bin/sh
cd `dirname $0`

AGENT_HOME=`pwd`

HOSTNAME=`hostname`
AGENT_NODE=agent@$HOSTNAME
AGENT_DB=db
MONITOR_LOG=/home/admin/container/logs/monitor.log 

SSH_DIR=${AGENT_HOME}/.ssh
SSH_PORT=8888

[ -f $AGENT_HOME/etc/agent.cfg ] && .  $AGENT_HOME/etc/agent.cfg

exec erl -pa $PWD/ebin $PWD/deps/*/ebin \
        -boot start_sasl \
        -s reloader  \
		-s mnesia \
        -s agent  \
        -name $AGENT_NODE \
         +K true +P 10240000  \
     	-mnesia dir ${AGENT_DB} \
        -config  config/elog.config \
        -setcookie abcd1234  \
        -env  monitor.log   $MONITOR_LOG  \
    	-env ssh.dir ${SSH_DIR} \
    	-env ssh.port ${SSH_PORT} \
         $*


